#include<iostream>
#include<string>
using namespace std;


class Calculater{

public:
	int a;
	int b;
	virtual	int getresult(){
		return 0;
	};
	void set_a(int a){
	this->a = a;
	}
	void set_b(int b){
	this->b = b;
	}
};

class add:public Calculater{
public:
		int getresult(){
		return a+b;
	}
};

class reduce:public Calculater{
public:
		int getresult(){
		return a-b;
	}
};
void test01(){
	Calculater * cal = new add;
	cal->set_a(10);
	cal->set_b(100);
	cout<<"result: "<<cal->getresult()<<endl;
	delete cal;
	cal = new reduce;
	cal->set_a(100);
	cal->set_b(70);
	cout<<"result: "<<cal->getresult()<<endl;
	delete cal;
	
}
int main(){
	test01();


	return 0;
}
